#ifndef SYLAR_MACOR_H
#define SYLAR_MACOR_H
#include <cstring>
#include <iostream>
#include <assert.h>
#include <execinfo.h>
#include "util.h"
#include "log.h"
#define SYLAR_ASSERT(x)                                                                 \
    if (!(x))                                                                           \
    {                                                                                   \
        SYLAR_LOG_ERROR(SYLAR_ERROR_LOGGER()) << "ASSERTION: " #x                          \
                                           << "\nbacktraece:\n"                         \
                                           << sylar::BackTraceToString(100, 2, "    "); \
        assert(x);                                                                      \
    }

#define SYLAR_ASSERT2(x, w)                                                             \
    if (!(x))                                                                           \
    {                                                                                   \
        SYLAR_LOG_ERROR(SYLAR_ERROR_LOGGER()) << "ASSERTION: " #x                          \
                                           << "\n"                                      \
                                           << w                                         \
                                           << "\nbacktraece:\n"                         \
                                           << sylar::BackTraceToString(100, 2, "    "); \
        assert(x);                                                                      \
    }

#endif